﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace GoldenAgeHelper.db
{
    public class DbOperator
    {

        public static IDBHelper helper;
        static DbOperator()
        {
            helper = Database.helper;
        }

        public static DataTable GetDatabases()
        {
            if (Database.types == DBType.Access)
            {
                return null;
            }
            return helper.GetConnection().GetSchema("databases");
        }

        public static DataTable GetTables()
        {
            string type = "BASE TABLE";
            if (Database.types == DBType.Access)
            {
                type = "TABLE";
            }
            return helper.GetConnection().GetSchema("tables", new string[] { null, null, null, type });
        }

        public static DataTable GetColumns(string tablename)
        {
            return helper.GetConnection().GetSchema("columns", new string[] { null, null, tablename });
        }
    }
}
